package com.party.mobile.biz.member;

import com.google.common.collect.Maps;
import com.party.api.dto.wechat.requst.XcxQrCodeRequest;
import com.party.common.constant.Constant;
import com.party.core.model.member.PartnerMember;
import com.party.core.model.system.RoleType;
import com.party.core.model.system.SysRole;
import com.party.core.model.wechatPlatform.WechatOpenMember;
import com.party.core.service.member.IPartnerMemberService;
import com.party.core.service.system.ISysRoleService;
import com.party.core.service.wechatPlatform.impl.WechatOpenMemberService;
import com.party.mobile.biz.file.FileBizService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @program: party
 * @description: 积分业务
 * @author: Hua Qunhao
 * @create: 2019-11-14 12:11
 **/
@Service
public class CIntegralBizToService {

    Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private ISysRoleService sysRoleService;


    /**
     * @Description:是否拥有行知公社权限
     * @Param:partnerId
     * @return:boolean
     * @Author: Hua Qunhao
     * @Date: 2019/11/22
     */
    public boolean isXZGSJurisdiction(String partnerId) {
        boolean isCommune = false;
        try {
            Map<String, Object> stringObjectMap = Maps.newHashMap();
            stringObjectMap.put("type", RoleType.PARTNER_ROLE.getCode());
            stringObjectMap.put("memberId", partnerId);
            List<SysRole> sysRoles = sysRoleService.getRoleByMemberId(stringObjectMap);

            for (SysRole s : sysRoles) {
                if ("knowing_commune".equalsIgnoreCase(s.getCode())) {
                    isCommune = true;
                }
            }
        } catch (Exception e) {
            logger.error("查询行知公社权限异常", e.getMessage());
        }
        return isCommune;
    }
}
